package com.fromfuture.xuhuidoc.android.utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;

/**
 * Created by hp on 2018/3/2.
 */

public class DialogUtil {
    public static void toastDialog(final Activity aty, final String message) {
        new AlertDialog.Builder(aty).setMessage(message).setNeutralButton("发送", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {

                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.setType("text/plain");
                sendIntent.putExtra(Intent.EXTRA_TEXT, message);
                sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                aty.startActivity(Intent.createChooser(sendIntent, "分享到"));
                dialogInterface.dismiss();
                dialogInterface.cancel();

            }
        }).setCancelable(true).create().show();
    }

}
